import React, { Component } from "react";
import PropTypes from "prop-types";

import GroupHeader from "./groupHeader";
import Box from "../../components/Box/box";
// import Icon from "../../components/Icon/";

// utils
import navigate from "../../utils/navigation.js";
import { get } from "../../utils/db.js";

const BoxItem = Box.Item;

export default class Bonus extends Component {
  constructor(props) {
    super(props);
  }
  render() {
    const {
      logCount = 0,
      auditCount = 0,
      signInCount = 0,
      // redPacketCount = 0,
      // attentCount = 0,
      // workHardCount = 0,
      contractCompanyName = ""
    } = this.props.bonusInfo;
    const { uid, username, userId, isSelf } = this.props;
    return (
      <div className="growth-bonus waterMark">
        <GroupHeader
          title="工作点滴"
          color="yellow"
          icon={
            <img
              className="growth-profile-icon"
              src="https://gw.alicdn.com/tfs/TB1N16IdjihSKJjy0FeXXbJtpXa-80-80.png"
            />
          }
        />

        <Box cols={4}>
          <BoxItem
            text={logCount}
            linkText="发送日志"
            ceiling={9999}
            hideIcon
            onClick={() => {
              window._rlog(`_growth_to_log`);
              const ismy = isSelf ? 1 : 2;
              navigate({
                ismy,
                system: "log",
                corpId: get("corpId"),
                userId,
                username
              });
            }}
          />
          <BoxItem
            text={auditCount}
            linkText="发起审批"
            ceiling={9999}
            hideIcon
            onClick={() => {
              window._rlog(`_growth_to_aflow`);
              navigate({
                system: "aflow",
                corpId: get("corpId"),
                userId,
                username
              });
            }}
          />
          <BoxItem
            text={signInCount}
            linkText="签到"
            ceiling={9999}
            hideIcon
            onClick={() => {
              window._rlog(`_growth_to_sign`);
              navigate({
                system: "signIn",
                corpId: get("corpId"),
                userId,
                username
              });
            }}
          />

          {/*  <BoxItem text={redPacketCount} linkText="专享红包" ceiling={9999} />
          <BoxItem text={attentCount} linkText="月全勤" ceiling={9999} />
          <BoxItem text={workHardCount} linkText="勤奋榜上榜" ceiling={9999} /> */}
        </Box>
      </div>
    );
  }
}

Bonus.propTypes = {
  bonusInfo: PropTypes.object,
  userId: PropTypes.string,
  uid: PropTypes.string,
  username: PropTypes.string
};
